<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition template="template-with-sidebar.xhtml" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ice="http://www.icesoft.com/icefaces/component"
                xmlns:odr="http://java.sun.com/jsf/composite/odr">

    <ui:define name="head">
        <script type="text/javascript" src="resources/js/sh_main.min.js"></script>
        <script type="text/javascript" src="resources/js/sh_latex.min.js"></script>t>

        <script type="text/javascript">
         j(document).ready(function() {
             sh_highlightDocument();
         });
        </script>

        <link type="text/css" rel="stylesheet" href="resources/css/sh_the.min.css" />
    </ui:define>

    <ui:define name="pagetitle">
        To Latex
    </ui:define>

    <ui:define name="content">
        <ice:panelGroup rendered="#{toLatexController.valid}">
            <pre class="sh_latex">
\documentclass{article}

\usepackage{hyperref, booktabs, textcomp}

\let\stdsection\section
\renewcommand\section{\newpage\stdsection}

\begin{document}
    \title{#{toLatexController.texEncode(toLatexController.project.name)}}
    \author{#{toLatexController.texEncode(toLatexController.member.person.name)}}
    \date{\today}

    \maketitle
    \newpage

    \tableofcontents
    \newpage

    \section{Abstract}
    \label{sec:abstract}

    This is an auto generated documentation of the #{toLatexController.texEncode(toLatexController.project.name)} project. It has been created using
    the Open Decision Repository.

    \begin{center}
        \url{http://code.google.com/p/opendecisionrepository/}
    \end{center}

    \subsection{Project description}
    \label{sec:abstract:project-description}
    #{toLatexController.texEncode(toLatexController.project.description)}

    \subsection{Stakeholder}
    \label{sec:abstract:stakeholder}

    \begin{table}[h]
      \centering
      \begin{tabular}{ lll }
          \toprule
          Name &amp; Email &amp; Role \\
          \midrule
<ice:repeat value="#{toLatexController.makeModifiable(toLatexController.project.members)}" var="member"><!--
    -->          #{toLatexController.texEncode(member.person.name)} &amp; #{toLatexController.texEncode(member.person.email)} &amp; #{toLatexController.texEncode(member.role.name)} \\
</ice:repeat><!--
-->
          \bottomrule
      \end{tabular}
      \caption{#{toLatexController.texEncode(toLatexController.project.name)} stakeholder}
      \label{table:stakeholder}
    \end{table}


    \section{Iterations}
    \label{sec:iterations}

<ice:repeat value="#{toLatexController.orderedIterations}" var="iteration"><!--
-->        \subsection{#{toLatexController.texEncode(iteration.name)}}
        \label{sec:iterations:#{iteration.id}}

        \begin{description}
            \item [From] <ice:outputText value="#{iteration.startDate}" nospan="true">
            <f:convertDateTime type="date" pattern="#{common['format.date.time']}" timeZone="#{timeZoneController.timeZone}" />
        </ice:outputText>
            \item [To] <ice:outputText value="#{iteration.endDate}" nospan="true">
            <f:convertDateTime type="date" pattern="#{common['format.date.time']}" timeZone="#{timeZoneController.timeZone}" />
        </ice:outputText>
            \item [Documented when] <ice:outputText value="#{iteration.documentedWhen}" nospan="true">
            <f:convertDateTime type="date" pattern="#{common['format.date.time']}" timeZone="#{timeZoneController.timeZone}" />
        </ice:outputText>
            \item [Documented by] #{toLatexController.texEncode(iteration.projectMember.person.name)} \textless #{toLatexController.texEncode(iteration.projectMember.person.email)} \textgreater
        \end{description}

        #{toLatexController.texEncode(iteration.description)}

        
</ice:repeat><!--
-->
    \section{Concerns}
    \label{sec:concerns}

<ice:repeat value="#{toLatexController.project.destinctConcerns}" var="concern"><!--
    -->        \subsection{#{toLatexController.texEncode(concern.name)}}
        \label{sec:concerns:#{concern.id}}

        \begin{description}
            \item [External id] #{toLatexController.texEncode(concern.externalId)}
            \item [Documented when] <ice:outputText value="#{concern.createdWhen}" nospan="true">
                <f:convertDateTime type="date" pattern="#{common['format.date.time']}" timeZone="#{timeZoneController.timeZone}" />
            </ice:outputText>
            \item [Documented by] #{toLatexController.texEncode(concern.initiators.person.name)} \textless #{toLatexController.texEncode(concern.initiators.person.email)} \textgreater
        \end{description}

        \subsubsection{Tags}
        \label{sec:concerns:#{concern.id}:tags}

        <ice:outputText value="\\begin{itemize}" nospan="true" rendered="#{!empty concern.tags}" />
        
<ice:repeat value="#{toLatexController.makeModifiable(concern.tags)}" var="tag" rendered="#{!empty concern.tags}"><!--
-->            \item #{toLatexController.texEncode(tag)}
</ice:repeat><!--
-->
        <ice:outputText value="        \\end{itemize}" nospan="true" rendered="#{!empty concern.tags}" />

        \subsubsection{Description}
        \label{sec:concerns:#{concern.id}:description}

        #{toLatexController.texEncode(concern.description)}
</ice:repeat><!--
-->


    \section{Decisions}
    \label{sec:decisions}

<ui:repeat value="#{toLatexController.makeModifiable(toLatexController.project.decisions)}" var="decision" rendered="#{!empty toLatexController.project.decisions}"><!--
-->
    \subsection{#{toLatexController.texEncode(decision.name)}}
    \label{sec:decisions:#{decision.id}}

    \begin{description}
        \item [State] #{toLatexController.texEncode(decision.currentVersion.state.statusName)}
    \end{description}

    \subsubsection{Initiators}
    \label{sec:decisions:#{decision.id}:initiators}

<ui:repeat value="#{toLatexController.makeModifiable(decision.currentVersion.initiators)}" var="initiator"><!--
-->    <ice:outputText value="#{toLatexController.texEncode(initiator.person.name)}" rendered="#{!empty initiator.person.name}" nospan="true"/> \textless #{toLatexController.texEncode(initiator.person.email)} \textgreater
</ui:repeat><!--
-->

    \subsubsection{Description}
    \label{sec:decisions:#{decision.id}:description}
</ui:repeat><!--
-->
\end{document}
            </pre>
        </ice:panelGroup>
    </ui:define>

    <ui:define name="sidebar">
    </ui:define>
</ui:composition>